package com.yyfax.ph.common.widgets;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.yyfax.common.mask.Component;
import com.yyfax.ph.R;

/**
 * Created by HenryZhang on 2017/5/8.<br>
 * Copyright © 2017 www.yylending.com. All Rights Reserved.<br><br>
 */
public class GuideMaskComponent implements Component {
	@Override
	public View getView(LayoutInflater inflater) {
		LinearLayout ll = new LinearLayout(inflater.getContext());
		LinearLayout.LayoutParams params =
				new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		ll.setOrientation(LinearLayout.VERTICAL);
		ll.setLayoutParams(params);
		ImageView arrow = new ImageView(inflater.getContext());
		LinearLayout.LayoutParams paramsArrow = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		paramsArrow.setMargins(0, 20, 42, 0);
		arrow.setLayoutParams(paramsArrow);
		arrow.setImageResource(R.drawable.guide_mask_arrow);
		ImageView btn = new ImageView(inflater.getContext());
		LinearLayout.LayoutParams paramsBtn = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		paramsBtn.setMargins(0, 74, 84, 0);
		btn.setLayoutParams(paramsBtn);
		btn.setImageResource(R.drawable.guide_mask_btn);//.arrow);
		btn.setId(R.id.common_dialog_btn_dismiss);
		ll.removeAllViews();
		ll.addView(arrow);
		ll.addView(btn);
		return ll;
	}

	@Override
	public int getAnchor() {
		return Component.ANCHOR_BOTTOM;
	}

	@Override
	public int getFitPosition() {
		return Component.FIT_END;
	}

	@Override
	public int getXOffset() {
		return -5;
	}

	@Override
	public int getYOffset() {
		return 0;
	}
}
